<html class="pixel-ratio-2 retina android android-6 android-6-0">
    
    <head>
        <include file="./Public/weui2.0/__head.html" />
        <style>
            .weui-cells {
                margin-top: 0;
            }
            #submit {
                margin: 15px;
                background:#12B7F5;
            }
            .weui-agree{
                display: inline-block;
            }
            .tab {
                display: inline-block;
                width: 49%;
            }
            #div2{
                display: none;
            }
            .name:after {
                border-bottom: 0px;
            }
            .demos-title{
            	color:#12B7F5;
            }
            .toolbar .picker-button{
                color: #3d4145;
            }
            


        </style>
    
        </head>


    
    <body ontouchstart="">
        <header class="demos-header">
            <h1 class="demos-title" id="title">用户注册</h1>
        </header>
        <div class="weui-tab">
           
    <div id="div1" class="weui-cells weui-cells_form">
        <div class="weui-cells weui-cells_form name">
            <div class="weui-cell">
                <div class="weui-cell__hd">
                    <label class="weui-label">姓名</label></div>
                <div class="weui-cell__bd">
                    <input id="name" class="weui-input" type="text" pattern="" placeholder="请输入姓名"></div>
            </div>
        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd">
                <label class="weui-label">学号</label>
            </div>
            <div class="weui-cell__bd">
                <input id="number" class="weui-input" type="number" pattern="[0-9]*" placeholder="请输入学号">
            </div>
        </div>
    </div>
    <div class="weui_btn_area">
        <a href="javascript:" id="submit" class="weui-btn weui-btn_primary" >注册</a>
    </div>


             
    </div>
    <include file="./Public/weui2.0/__foot.html" />
    <script src="__PUBLIC__/js/city-picker.js"></script>

    <script>

        $('#submit').click(function(){
            // alert("message?: DOMString");
            url  = "{:U('User/register')}";
            var name = $("#name").val();
            var number = $('#number').val();
            if(!name){
                $.toptip('请输入姓名');
                return false;
            }
            else if(!number){
                $.toptip('请输入学号');
                return false;
            }
            else if(number.length < 9){
                $.toptip('号码必须大于9位数');
                return false;
            }
            else {
              /*=============上传数据==========*/

                data = {
                    'name'   : name,
                    'number' : number,
                    'is_newer':0,
                }
            }

              $.post(url,data,function(res){
                
                if(res != 'success') {
                    $.alert(res,"确定");
                } else {
                    $.showLoading();
                    setTimeout(function() {
                        $.hideLoading();
                        $.toast("注册成功");
                        window.location.href="{:U('User/index', array('openId'=>$openId))}";//
                    }, 1000)
                }
              });


        });

    </script>
</body>

</html>